<div class="block-header">
    <div class="catehome">
        <div class="leftbg">
            <div class="tittle"><!--Top Views--><?php echo $lang['TOPVIEWS']; ?></div>
        </div>
        <div class="rightbg">&nbsp;</div> 
        <div class="clear"></div>
    </div>			
</div> 
<div style="border-top: 1px solid #EFEFEF; height: 13px;" class="clear">&nbsp;</div>
<div class="newproducts">
    <div class="carousel">
        <div class="slider">
            <?php
            $sql = "SELECT t1.*, COUNT, t3.price, t3.pid, t2.images, t2.thumbnail FROM tblproduct AS t1
                        INNER JOIN tblimage AS t2 ON t1.id=t2.product_id
                        INNER JOIN tblproduct_in_pharmacy AS t3 ON t1.id=t3.product_id
                        INNER JOIN counter ON counter.pd_id=t1.id
                        WHERE t1.status = 1 ORDER BY t1.top_view DESC LIMIT 0,8";
            $result = mysql_query($sql);
            $i = 0;
            $border = "";
            while ($row = mysql_fetch_assoc($result)) {
                if ($i % 4 == 0 && $i > 0) {
                    echo '';
                    $border = "";
                } else if ($i % 4 > 0) {
                    $border = '';
                }
                ?>              
                <div class="item slide " style="float: left; width: 280px;"> 
                    <a class="product-image" <a href="product/product_detail.php?product_id=<?php echo $row['id'] ?>" title="<?php echo $row['product_name'] ?>"><img src="<?php echo W_S_IMAGES_DIR . $row['thumbnail'] ?>" /></a>
                        <div class="new-description" style="width:150px;">
                            <div class="title">
                                <a href="product/product_detail.php?product_id=<?php echo $row['id'] ?>" title="<?php echo $row['product_name'] ?>">
                                    <?php
                                    $char = 20;
                                    $title = $row['product_name'];
                                    $readmore = rm($title, $char);
                                    echo $readmore;
                                    ?>
                                </a>
                            </div>
                            <div class="price-box">
                                <p class="special-price">
                                    <span id="product-price-305" class="price"><?php echo $row['price'] ?>&nbsp;$</span>
                                </p>
                            </div> 
                        </div>                    
                </div>
    <?php $i++;
} ?>
            <!-- end item -->
        </div>                    
    </div>
    <div class="prev new-arrow disabled" style="cursor: pointer;">&nbsp;</div>
    <div class="next new-arrow" style="cursor: pointer;">&nbsp;</div>          
</div>            

<div style="clear: both;"></div>
<script type="text/javascript">
    jQuery('.new-arrow.prev').addClass('disabled');
    jQuery('.carousel').iosSlider({
        desktopClickDrag: true,
        snapToChildren: true,
        infiniteSlider: false,
        navNextSelector: '.new-arrow.next',
        navPrevSelector: '.new-arrow.prev',
        lastSlideOffset: 3,
        onFirstSlideComplete: function() {
            jQuery('.new-arrow.prev').addClass('disabled');
        },
        onLastSlideComplete: function() {
            jQuery('.new-arrow.next').addClass('disabled');
        },
        onSlideChange: function() {
            jQuery('.new-arrow.prev').removeClass('disabled');
            jQuery('.new-arrow.next').removeClass('disabled');
        }
    });
</script>   
